{% extends "admin/base_site.html" %}
{% load adminmedia admin_list i18n %}

{% block stylesheet %}{% admin_media_prefix %}css/changelists.css{% endblock %}
{% block bodyclass %}change-list{% endblock %}
{% block coltype %}colMS{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs">
	<a href="../">{% trans "Home" %}</a> &rsaquo;
	<a href="./">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
</div>
{% endblock %}

{% block content %}

<style type="text/css">
#block-search p
{
	float: left;
}
</style>

<div id="content-main">

<!-- search form begin -->
<div id="block-search">
<form
	name="form-search-query"
	action="__search__/"
	method="POST"
>
	{{form.as_p}}
	&nbsp;
	<input type="submit" name="search" value="{% trans "Search" %}" />
	<div style="clear:both;"></div>
</form>
</div>
<!-- search form end -->

<div class="module">

{% block result-list %}
<table class="table-search" width="100%">
<caption>{% trans "Index Information" %}</caption>
<tr>
	<th scope="row">{% trans "Total indexed document count" %}:</th>
	<td>{{reader.numDocs}}</td>
</tr>
<tr>
	<th scope="row">{% trans "Last indexed time" %}:</th>
	<td>{{reader.last_modified_time|date:"r T"}}</td>
</tr>
<tr>
	<th scope="row">{% trans "Index Version" %}:</th>
	<td>{{reader.get_version}}</td>
</tr>
<tr>
	<th scope="row">{% trans "Is optimized?" %}:</th>
	<td>
<form
	action="__optimize__/"
	method="POST"
>
		{{reader.is_optimized|yesno}}
		{% if not reader.is_optimized %}
			<input type="submit"
				value="{% trans "Optimize?" %}"
		/>
		{% endif %}
</form>
	</td>
</tr>
</table>


<br />
<table width="100%">
<caption>{% trans "Lucene Models" %}</caption>
<thead>
<tr>
	<th scope="col">{% trans "Model Name" %}</th>
	<th scope="col">{% trans "DocumentCount" %}</th>
</tr>
</thead>
<tbody>
{% for model in model_list %}
<tr>
	<td>
		<a
			href="{{model.model_name}}/"
			>{{model.name|capfirst}}({{model.app_label}})</a>
	</td>
	<td align="right">{{model.model.objects_search.count}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

</div>

</div>
{% endblock %}

{% block sidebar %}
<div id="content-related">
	<div class="module">
		<h2>{% trans 'Actions' %}</h2>
		<h3><a href="__clean__/"
			onclick='
{% if not reader.numDocs %}
return false;
{% endif %}
if (! window.confirm("{% trans "Do you really clean up the entire objects?" %}"))
{
	return false;
}
return true;
			'
		>{% trans 'Remove All indexed objects' %}</a></h3>
	</div>
</div>
{% endblock %}
